package com.learning.client;

import org.apache.http.HttpResponse;
import org.apache.http.client.HttpClient;
import org.apache.http.client.methods.HttpGet;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.impl.client.DefaultHttpClient;
import org.apache.http.util.EntityUtils;

public class HttpClient3 {
	public static void main(String[] args) {
		HttpClient client=new DefaultHttpClient();
		String path="http://www.ifeng.com";
		HttpGet get=new HttpGet(path);
		try {
            HttpResponse response=client.execute(get);
            int status=response.getStatusLine().getStatusCode();
            if(status==200)
            	System.out.println(EntityUtils.toString(response.getEntity(), "utf-8"));
		} catch (Exception e) {
		}
	}

}
